/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package isd.inventario.modelo;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Claudio
 */
@Entity
@Table(name = "sttfoi")
@IdClass(ST_ItemComposicionFormulaPK.class)
public class ST_ItemComposicionFormula implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "STTFOI_TIPPRO", nullable = false, length = 6)
    private String tippro;
    @Id
    @Column(name = "STTFOI_ARTCOD", nullable = false, length = 30)
    private String artcod;
    @Id
    @Column(name = "STTFOI_FORMUL", nullable = false, length = 8)
    private String formul;
    @Id
    @Column(name = "STTFOI_NROITM", nullable = false)
    private int nroitm;

    /**
     * Composición de formula
     */
    @ManyToOne(optional=false)
    @JoinColumns({
    @JoinColumn(name = "STTFOI_TIPPRO", referencedColumnName = "STTFOH_TIPPRO", nullable = false, insertable=false, updatable=false),
    @JoinColumn(name = "STTFOI_ARTCOD", referencedColumnName = "STTFOH_ARTCOD", nullable = false, insertable=false, updatable=false),
    @JoinColumn(name = "STTFOI_FORMUL", referencedColumnName = "STTFOH_FORMUL", nullable = false, insertable=false, updatable=false)
    })    
    private ST_ComposicionFormula composicionFormula;

    /**
     * Producto componente
     */
    @JoinColumns({
    @JoinColumn(name = "STTFOI_TIPITM", referencedColumnName = "STMPDH_TIPPRO", nullable = false),
    @JoinColumn(name = "STTFOI_ARTITM", referencedColumnName = "STMPDH_ARTCOD", nullable = false)
    })
    @ManyToOne(optional=false)
    private ST_Producto productoComponente;
 
    /**
     * Unidad de medida del componente
     */
    @ManyToOne
    @JoinColumn(name = "STTFOI_UNIITM", referencedColumnName = "STTUNI_UNIDAD", nullable = false, insertable=false, updatable=false)
    private ST_UnidadMedida unidadMedidaItem;
    /**
     * Cantidad nominal
     */
    @Column(name = "STTFOI_CNTNOM", precision = 20, scale = 8)
    private BigDecimal cntnom;
    /**
     * Cantidad real
     */
    @Column(name = "STTFOI_CNTREA", precision = 20, scale = 8)
    private BigDecimal cntrea;

    /**
     * Registro de calidad
     */
    @Column(name = "STTFOI_REGCAL", length = 14)
    private String regcal;
    /**
     * Secuencia de fabricación
     */
    @Column(name = "STTFOI_SECFAB", precision = 12)
    private Float secfab;

    /**
     * Factor de consumo
     */
    @Column(name = "STTFOI_FACONS", precision = 18, scale = 8)
    private BigDecimal facons;
    /**
     * Factor de consumo 1
     */
    @Column(name = "STTFOI_FACON1", precision = 18, scale = 8)
    private BigDecimal facon1;
    /**
     * Factor de consumo 2
     */
    @Column(name = "STTFOI_FACON2", precision = 18, scale = 8)
    private BigDecimal facon2;
    /**
     * Factor de consumo 3
     */
    @Column(name = "STTFOI_FACON3", precision = 18, scale = 8)
    private BigDecimal facon3;
    
    /**
     * Verifica disponibilidad de stock
     */

    @Basic(optional = false)
    @Column(name = "STTFOI_VERDIS", nullable = false)
    private char verdis;
    /**
     * Reposición automática
     */
    @Basic(optional = false)
    @Column(name = "STTFOI_REPAUT", nullable = false)
    private char repaut;

    @Column(name = "STTFOI_FECALT")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecalt;
    @Column(name = "STTFOI_FECMOD")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecmod;
    @Column(name = "STTFOI_USERID", length = 15)
    private String userid;
    @Column(name = "STTFOI_ULTOPR")
    private Character ultopr;
    @Column(name = "STTFOI_DEBAJA")
    private Character debaja;
    @Column(name = "STTFOI_HORMOV", length = 10)
    private String hormov;
    @Column(name = "STTFOI_MODULE", length = 10)
    private String module;
    @Column(name = "STTFOI_OALIAS", length = 10)
    private String oalias;
    @Column(name = "STTFOI_TSTAMP")
    @Temporal(TemporalType.TIMESTAMP)
    private Date tstamp;
    @Column(name = "STTFOI_LOTTRA", length = 6)
    private String lottra;
    @Column(name = "STTFOI_LOTREC", length = 6)
    private String lotrec;
    @Column(name = "STTFOI_LOTORI", length = 6)
    private String lotori;
    @Column(name = "STTFOI_SYSVER", length = 10)
    private String sysver;
    @Column(name = "STTFOI_CMPVER", length = 10)
    private String cmpver;

    public ST_ItemComposicionFormula() {
    }

    public ST_ItemComposicionFormula(String tippro, String artcod, String formul, int nroitm) {
        this.tippro = tippro;
        this.artcod = artcod;
        this.formul = formul;
        this.nroitm = nroitm;
    }

    public String getArtcod() {
        return artcod;
    }

    public void setArtcod(String artcod) {
        this.artcod = artcod;
    }

    public String getFormul() {
        return formul;
    }

    public void setFormul(String formul) {
        this.formul = formul;
    }

    public int getNroitm() {
        return nroitm;
    }

    public void setNroitm(int nroitm) {
        this.nroitm = nroitm;
    }

    public String getTippro() {
        return tippro;
    }

    public void setTippro(String tippro) {
        this.tippro = tippro;
    }
    
    public String getCmpver() {
        return cmpver;
    }

    public void setCmpver(String cmpver) {
        this.cmpver = cmpver;
    }

    public BigDecimal getCntnom() {
        return cntnom;
    }

    public void setCntnom(BigDecimal cntnom) {
        this.cntnom = cntnom;
    }

    public BigDecimal getCntrea() {
        return cntrea;
    }

    public void setCntrea(BigDecimal cntrea) {
        this.cntrea = cntrea;
    }

    public Character getDebaja() {
        return debaja;
    }

    public void setDebaja(Character debaja) {
        this.debaja = debaja;
    }

    public BigDecimal getFacon1() {
        return facon1;
    }

    public void setFacon1(BigDecimal facon1) {
        this.facon1 = facon1;
    }

    public BigDecimal getFacon2() {
        return facon2;
    }

    public void setFacon2(BigDecimal facon2) {
        this.facon2 = facon2;
    }

    public BigDecimal getFacon3() {
        return facon3;
    }

    public void setFacon3(BigDecimal facon3) {
        this.facon3 = facon3;
    }

    public BigDecimal getFacons() {
        return facons;
    }

    public void setFacons(BigDecimal facons) {
        this.facons = facons;
    }

    public Date getFecalt() {
        return fecalt;
    }

    public void setFecalt(Date fecalt) {
        this.fecalt = fecalt;
    }

    public Date getFecmod() {
        return fecmod;
    }

    public void setFecmod(Date fecmod) {
        this.fecmod = fecmod;
    }

    public String getHormov() {
        return hormov;
    }

    public void setHormov(String hormov) {
        this.hormov = hormov;
    }

    public String getLotori() {
        return lotori;
    }

    public void setLotori(String lotori) {
        this.lotori = lotori;
    }

    public String getLotrec() {
        return lotrec;
    }

    public void setLotrec(String lotrec) {
        this.lotrec = lotrec;
    }

    public String getLottra() {
        return lottra;
    }

    public void setLottra(String lottra) {
        this.lottra = lottra;
    }

    public String getModule() {
        return module;
    }

    public void setModule(String module) {
        this.module = module;
    }

    public String getOalias() {
        return oalias;
    }

    public void setOalias(String oalias) {
        this.oalias = oalias;
    }

    public String getRegcal() {
        return regcal;
    }

    public void setRegcal(String regcal) {
        this.regcal = regcal;
    }

    public char getRepaut() {
        return repaut;
    }

    public void setRepaut(char repaut) {
        this.repaut = repaut;
    }

    public Float getSecfab() {
        return secfab;
    }

    public void setSecfab(Float secfab) {
        this.secfab = secfab;
    }

    public String getSysver() {
        return sysver;
    }

    public void setSysver(String sysver) {
        this.sysver = sysver;
    }

    public Date getTstamp() {
        return tstamp;
    }

    public void setTstamp(Date tstamp) {
        this.tstamp = tstamp;
    }

    public Character getUltopr() {
        return ultopr;
    }

    public void setUltopr(Character ultopr) {
        this.ultopr = ultopr;
    }

    public ST_UnidadMedida getUnidadMedidaItem() {
        return unidadMedidaItem;
    }

    public void setUnidadMedidaItem(ST_UnidadMedida unidadMedidaItem) {
        this.unidadMedidaItem = unidadMedidaItem;
    }
    
    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid;
    }

    public char getVerdis() {
        return verdis;
    }

    public void setVerdis(char verdis) {
        this.verdis = verdis;
    }

    public ST_ComposicionFormula getComposicionFormula() {
        return composicionFormula;
    }

    public void setComposicionFormula(ST_ComposicionFormula composicionFormula) {
        this.composicionFormula = composicionFormula;
    }

    public ST_Producto getProductoComponente() {
        return productoComponente;
    }

    public void setProductoComponente(ST_Producto productoComponente) {
        this.productoComponente = productoComponente;
    }


    
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ST_ItemComposicionFormula other = (ST_ItemComposicionFormula) obj;
        if ((this.tippro == null) ? (other.tippro != null) : !this.tippro.equals(other.tippro)) {
            return false;
        }
        if ((this.artcod == null) ? (other.artcod != null) : !this.artcod.equals(other.artcod)) {
            return false;
        }
        if ((this.formul == null) ? (other.formul != null) : !this.formul.equals(other.formul)) {
            return false;
        }
        if (this.nroitm != other.nroitm) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 41 * hash + (this.tippro != null ? this.tippro.hashCode() : 0);
        hash = 41 * hash + (this.artcod != null ? this.artcod.hashCode() : 0);
        hash = 41 * hash + (this.formul != null ? this.formul.hashCode() : 0);
        hash = 41 * hash + this.nroitm;
        return hash;
    }

    @Override
    public String toString() {
        return "ST_ItemComposicionFormula{" + "tippro=" + tippro + "artcod=" + artcod + "formul=" + formul + "nroitm=" + nroitm + '}';
    }
    

    



}
